package com.moli.iov.task.jobhandler;

import com.moli.iov.handle.alarm.service.IAlarmInfoTaskRequestService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHander;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 车辆72小时离线报警
 * </p>
 *
 * @Auther: zql
 * @Date: 2019/2/19 15:48
 */

@Slf4j
@JobHander(value="offLineAlarmJobHandler")
@Component
public class OffLineAlarmJobHandler extends IJobHandler {

    @Autowired
    private IAlarmInfoTaskRequestService alarmInfoTaskRequestService;

    @Override
    public ReturnT<String> execute(String... params) throws Exception {
        try {
            alarmInfoTaskRequestService.offLineAlarm();
            return ReturnT.SUCCESS;
        }catch(Exception e){
            log.error("车辆72小时离线报警 异常", e);
            return ReturnT.FAIL;
        }
    }
}
